Repository navigation
fix: honor ISO 8601 offsets when deserializing dates - #443
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ISO 8601 timestamps with an explicit offset are currently parsed with a format that stops before the offset. Consequently, the same API response produces different instants depending on the JVM's default time zone. For example,
2019-07-11T07:40:22+00:00becomes2019-07-11T11:40:22ZinAmerica/New_York.Parse offset-bearing ISO timestamps with Java 8's
OffsetDateTimeand convert the resulting instant toDate. Keep the existing parsing paths for legacy timestamps without a zone. This also preserves fractional seconds in ISO timestamps.Regression tests exercise the registered Jackson deserializer under a non-UTC default time zone, covering zero, positive and negative offsets,
Z, fractional seconds, and legacy and empty values. The original default zone is restored after each test.Validation:
./gradlew --offline --no-daemon buildpasses all 894 tests on JDK 8 with Gradle 7.6.4. The regression test fails on the original implementation (1 failure out of 2 tests) and passes with the fix (2 tests).AI assistance was used to prepare this change and its tests.